-content_for :modal_title do
  -if f.object.new_record?
    Create a new risk
  -else
    Edit risk

-content_for :modal_help, 'risk_form'

-if !f.object.new_record?
  -content_for :modal_delete_path, delete_flow_risk_path(f.object)

.row-fluid
  .span12
    =wrapped_text_field f, :span12, :title, :placeholder => 'Enter title', :label_name => 'Title <span class="required">*</span>'.html_safe

.row-fluid
  .span6
    =wrapped_text_area f, :span12, :description, :class => 'double wysihtml5 rtftextarea', :wrapper_div_class => 'wysiwyg-area', :placeholder => 'Enter description here'
  .span6
    .row-fluid
      .span4
        =wrapped_text_field f, :span12, :slug, :label_name => 'Code (autofill)', :placeholder => 'RISK-XXXX'
      .span4
        =wrapped_date_field f, :span12, :start_date, :class => 'date', :label_name => 'Effective Date', :placeholder => 'MM/DD/YYYY'
      .span4
        =wrapped_date_field f, :span12, :stop_date, :class => 'date', :label_name => 'Stop Date', :placeholder => 'MM/DD/YYYY'
    .row-fluid
      .span12
        =wrapped_text_field f, :span12, :url, :label_name => 'Direct URL for Product (optional)', :placeholder => 'http://www.example.com/'


.row-fluid
  .span4
    =wrapped_text_area f, :span12, :inherent_risk, :class => 'double wysihtml5 rtftextarea', :wrapper_div_class => 'wysiwyg-area', :placeholder => 'Enter inherent risk note here'
  .span4
    =wrapped_text_area f, :span12, :risk_mitigation, :class => 'double wysihtml5 rtftextarea', :wrapper_div_class => 'wysiwyg-area', :placeholder => 'Enter risk mitigation note here'
  .span4
    =wrapped_text_area f, :span12, :residual_risk, :class => 'double wysihtml5 rtftextarea', :wrapper_div_class => 'wysiwyg-area', :placeholder => 'Enter residual risk note here'

.row-fluid
  .span6
    %h2 Causes/Threats
  .span6
    %h2 Impacts

.row-fluid
  .span6
    =f.label :likelihood
    .wysiwyg-area
      =f.select :likelihood_rating, Risk::RATINGS.map { |k, v| ["#{((k.to_f / 5.0) - 0.2).round(1)}", ((k.to_f / 5.0) - 0.2).round(1)] }
      =f.text_area :likelihood, :class => 'span12 double wysihtml5 rtftextarea', :placeholder => ''
  .span6
    =wrapped_text_area f, :span12, :impact, :class => 'double wysihtml5 rtftextarea', :wrapper_div_class => 'wysiwyg-area', :placeholder => 'Enter impact description here', :label_name => "Impact Description"

.row-fluid
  .span6
    =wrapped_text_area f, :span12, :threat_vector, :class => 'double wysihtml5 rtftextarea', :wrapper_div_class => 'wysiwyg-area', :placeholder => '', :label_name => "Threat Vector"
  .span6
    =f.label :reputational_impact_rating, "Company-wide Reputational Impact"
    =f.select :reputational_impact_rating, Risk::RATINGS.map { |k, v| ["#{k} - #{v}", k] }
    =f.label :financial_impact_rating, "Company-wide Financial Impact"
    =f.select :financial_impact_rating, Risk::RATINGS.map { |k, v| ["#{k} - #{v}", k] }
    =f.label :operational_impact_rating, "Company-wide Operational Impact"
    =f.select :operational_impact_rating, Risk::RATINGS.map { |k, v| ["#{k} - #{v}", k] }

.row-fluid
  .span6
    =wrapped_text_area f, :span12, :trigger, :class => 'double wysihtml5 rtftextarea', :wrapper_div_class => 'wysiwyg-area', :placeholder => '', :label_name => "Trigger/Immediate /Proximate Cause"
  .span6

.row-fluid
  .span6
    =wrapped_text_area f, :span12, :preconditions, :class => 'double wysihtml5 rtftextarea', :wrapper_div_class => 'wysiwyg-area', :placeholder => '', :label_name => "Pre-conditions / Contributory Causes"

%br

=render :partial => "shared/wysihtml5"

